package com.dev.tools.listener;

import lombok.RequiredArgsConstructor;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

/**
 * @Classname MyService
 * @Description TODO
 * @Date 2022/7/12 18:02
 * @Author niu hao
 */
@Service
@RequiredArgsConstructor
public class MyService {

    private final ApplicationContext applicationContext;

    public void run(String str) {
        long start = System.currentTimeMillis();
        applicationContext.publishEvent(new MyEvent(str));
        long end = System.currentTimeMillis();
        System.out.println((end - start) + "ms");
    }
}
